package com.superman.libyuvdemo

import android.content.Intent
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.activity.result.contract.ActivityResultContracts
import androidx.compose.foundation.layout.Column
import androidx.compose.material3.Button
import androidx.compose.material3.Text

class MainActivity : ComponentActivity() {


    private val permissionCallback: (Boolean) -> Unit = { }

    private val permissionLauncher = registerForActivityResult(
        ActivityResultContracts.RequestPermission(),
        permissionCallback
    )

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        PermissionUtil.checkAppPermission(this, permissionLauncher, PermissionUtil.a, {}, {})
        PermissionUtil.checkAppPermission(this, permissionLauncher, PermissionUtil.b, {}, {})
        PermissionUtil.checkAppPermission(this, permissionLauncher, PermissionUtil.c, {}, {})

        setContent {
            Column {

                Button(onClick = {
                    startActivity(Intent(baseContext, EncodeUsingEGLAndSurfaceActivity::class.java))
                }) {
                    Text(text = "EncodeUsingEGLAndSurfaceActivity")
                }
            }
        }
    }
}


